package com.exchange.plugin.hazelcast;

import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.config.ClientNetworkConfig;
import com.hazelcast.jet.Jet;
import com.hazelcast.jet.JetInstance;
import com.jfinal.plugin.IPlugin;
import cn.hutool.core.collection.CollectionUtil;

public class HazelcastPlugin implements IPlugin {

	public static JetInstance jetc = null;
	
	public HazelcastPlugin(){
		if(jetc == null){
			
			ClientConfig cc = new ClientConfig();
			cc.setClusterName("match");
			ClientNetworkConfig cnwc = new ClientNetworkConfig();
			cnwc.setAddresses(CollectionUtil.newArrayList("127.0.0.1:5701", "127.0.0.1:5702", "127.0.0.1:5703"));
			cc.setNetworkConfig(cnwc);
			jetc = Jet.newJetClient(cc);
		}
		
		
	}
	
	@Override
	public boolean start() {
		System.err.println("HazelcastPlugin初始化成功JetInstance");
		return true;
	}

	@Override
	public boolean stop() {
		System.err.println("HazelcastPlugin初始化失败JetInstance");
		return true;
	}
	
}